package com.dot.base.wait02;

import java.util.Objects;

public class Thread01 {
    private Object object = new Object();
    public static void main(String[] args) throws InterruptedException {
        Thread01 thread01 = new Thread01();
        thread01.print();
    }
    public void print() throws InterruptedException {
        //主动释放this锁，同时当前主现场变成了阻塞状态
        new Thread(new Runnable() {
            @Override
            public void run() {
                synchronized (object){
                    try {
                        object.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }
}
